package cn.com.customer.manager.adapter

import cn.com.customer.manager.R
import cn.com.customer.manager.bean.CallPlayInfo
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.xuexiang.xui.widget.imageview.RadiusImageView

class PhoneAdapter(rid: Int) : BaseQuickAdapter<CallPlayInfo, BaseViewHolder>(rid) {
    override fun convert(helper: BaseViewHolder?, item: CallPlayInfo?) {
        helper?.let { hel ->
            val ivMsgType = helper?.getView(R.id.iv_msg_type) as RadiusImageView
            ivMsgType.setImageResource(R.drawable.photo_icon)
            item?.let {
                if ( it.receiveBean!=null){
                    hel.setText(R.id.tv_msg_name, it.receiveBean?.receiveName+":"+it.receiveBean?.receiveMobile)
                    hel.setText(R.id.tv_msg_desc, "通话时长"+ it.receiveBean?.callDuration)
                    hel.setText(R.id.tv_time_msg, it.receiveBean?.callDate)
                }else{
                    hel.setText(R.id.tv_msg_name, it?.sendBean?.sendName+":"+it.sendBean?.sendMobile)
                    hel.setText(R.id.tv_msg_desc, "通话时长"+it?.sendBean?.callDuration)
                    hel.setText(R.id.tv_time_msg, it?.sendBean?.callDate)
                }
            }

        }
    }
}